﻿/* Created on 2017.3.22
 *
 * @author: jia
 */

#pragma once
#include "kbeconfig.h"
#include <thread>

class KBEApp;

class KBEThread
{
public:
    KBEThread(KBEApp* app);
    ~KBEThread();

	void run();
public:
	bool over = false;
private:
	KBEApp *m_app = nullptr;
};


class KBEApp
{
public:
    KBEApp(KBEConfig *config);
    ~KBEApp();

	bool initialize();
	void process();
private:
	void initNetwork();
private:
	KBEConfig *m_cfg = nullptr;
	KBEThread *kbethread = nullptr;

	std::thread *_t = nullptr;

	// 主循环频率
	int threadUpdateHZ = 10;

	// 主循环周期ms 优化去掉循环中做除法
	double threadUpdatePeriod = 1000.0f / threadUpdateHZ;

	// 插件是否退出
	bool _isbreak = false;
};
